package com.iplay.实战java高并发程序设计.chapter5.c55;

/**
 * @author dangwu
 * @since 2021/11/5 4:44 下午
 */
public class RealData implements Data{
    protected final String result;
    public RealData(String para){
        //realData的构造可能很慢，需要用户等待很久，这里使用sleep模拟
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < 10; i++) {
            sb.append(para);
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        result = sb.toString();
    }
    @Override
    public String getResult() {
        return result;
    }
}
